package com.touchalachs.game;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Point;

import com.touchalachs.core.CanvasTool;
import com.touchalachs.core.Drawable;
import com.touchalachs.core.StringTool;
import com.touchalachs.core.ui.Label;

public class Score implements Drawable{
	
	private final Label pointsLabel;
	private final Label incomeLabel;
	private final Paint paint;
	private final Calculator calc;
	
	public Score(Point scrSize, Calculator calc){
		this.calc = calc;
		pointsLabel = new Label(25, 6, 40, 5, "", scrSize);
		incomeLabel = new Label(25, 12, 40, 5, "", scrSize);
		paint = new Paint();
		paint.setColor(Color.argb(127, 0, 0, 0));
	}
	
	@Override
	public void draw(Canvas canvas) {		
		pointsLabel.setText(StringTool.format(calc.getScore())+" "+ Res.LACHSE);
		incomeLabel.setText(StringTool.format(calc.getIncome(), 1)+" "+  Res.LPS);
		canvas.drawRect(CanvasTool.pctToScr(0, 5, 100, 13, canvas), paint);
		pointsLabel.draw(canvas);
		incomeLabel.draw(canvas);
	}
}
